<?php
class Users_model extends CI_Model {
    function __construct()
    {
        parent::__construct();
    }

    function get_all_article()
    {
        $query = $this->db->get('article');
        return $query->result();
    }
    function get_id_article($id){
        if($id && is_array($id) && count($id)>0){
            return $this->db->get_where('article',$id)->result();
        }
        return "No match database";
        
    }

    function add_user($data)
    {
        return $this->db->insert($data['table'],$data['array']);
    }

    function update_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }

}